package com.tianqu.tms.dao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.poi.hssf.record.formula.functions.T;

import com.tianqu.tms.core.base.Logger;
import com.tianqu.tms.core.exception.TmsDaoException;
import com.tianqu.tms.core.webservice.TmsCarGateService;
import com.tianqu.tms.dto.TransferProcessHistoryDto;

/**
 * @author Huang Wei
 *
 */
public class TmsConfigureDaoimp extends TmsDao implements TmsConfigureDao  {
	
	private Logger LOGGER = Logger.getLogger(TmsConfigureDaoimp.class);
	
	protected TmsConfigureDaoimp() throws TmsDaoException { super(); }

	@Override
	public String getConfig(String k) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		String v = null;
		try {
			StringBuffer sql = new StringBuffer(" ");
			sql.append("SELECT confValue");
			sql.append(" FROM ");
			sql.append( TmsTableNames.TMS_CONFIGURE);
			sql.append(" WHERE ");
			sql.append(" confKey=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, k);
			rs = ps.executeQuery();
			while (rs.next()) { v = rs.getString("confValue"); break; 	}
		} catch (SQLException e) {
			LOGGER.error("TmsConfigureDaoimp error",e);
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
		return v;
	}
	
}
